﻿package com.sos.ui
{
	import com.sos.core.game.GameMod;
	import com.sos.core.cards.CardManager;
	import Error;
	
	public class Effect extends Object 
	{
		public var effectId:String;
		public var instanceId:String;
		public var effectName:String;
		public var effectText:String;
		public var type:String;
		public var targetList:Array = new Array();
		public var imageId:String;
		
		public function Effect(efData:GameMod, targetInstanceId:String) {
			
			this.effectId = efData.id.toString();
			this.instanceId = efData.instanceId.toString();
			this.effectName = efData.name;
			this.effectText = efData.description;
			this.type = efData.type.name;
			this.targetList.push(targetInstanceId);
			
			try {
				imageId = CardManager.getCardManager().getCardById(efData.sourceCardId).image;
			}
			catch (ex:Error) {
				//trace("ERROR FETCHING IMAGE FOR EFFECT " + efData.name);
			}
			if (!imageId) 
				imageId = 'ACBlank';
			
			
		}
		
		public function addTarget(targetInstanceId:String) {
			this.targetList.push(targetInstanceId);
		}
		
		public function removeTarget(targetInstanceId:String) {
			delete targetList[targetInstanceId];
		}
	}
}